home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 February: Tool Chest / Dev.CD Feb 95 / Dev.CD Feb 95.toast / Tool Chest / Interfaces / Universal Interfaces 1.0 / CIncludes / time.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-03  |  1.9 KB  |  87 lines  |  [TEXT/MPS ]

  1. /************************************************************
  2.  
  3.     Time.h
  4.     Date and time
  5.     
  6.     Copyright © Apple Computer,Inc.  1987-1991, 1993, 1994.
  7.     All Rights Reserved.
  8.  
  9. ************************************************************/
  10.  
  11.  
  12. #ifndef __TIME_H__ /* __TIME__ is a reserved preprocessor symbol */
  13. #define __TIME_H__
  14.  
  15. #ifndef NULL
  16. #define NULL 0
  17. #endif
  18.  
  19. #ifndef __size_t__
  20. #define __size_t__
  21. typedef unsigned int size_t;
  22. #endif
  23.  
  24. /*
  25.  *    Declarations
  26.  */
  27.  
  28. #define CLOCKS_PER_SEC 60
  29. typedef unsigned long int clock_t;
  30. typedef unsigned long int time_t;
  31. #ifdef powerc
  32. #pragma options align=power
  33. #endif
  34. struct tm {
  35.     int tm_sec;        /* Seconds after the minute -- [0, 61] */
  36.     int tm_min;        /* Minutes after the hour -- [0, 59] */
  37.     int tm_hour;    /* Hours after midnight -- [0, 23] */
  38.     int tm_mday;    /* Day of the month -- [1, 31] */
  39.     int tm_mon;        /* Months since January -- [0, 11] */
  40.     int tm_year;    /* Years since 1900 */
  41.     int tm_wday;    /* Days since Sunday -- [0, 6] */
  42.     int tm_yday;    /* Days since January 1 -- [0, 365] */
  43.     int tm_isdst;    /* Daylight Savings Time flag */
  44. };
  45. #ifdef powerc
  46. #pragma options align=reset
  47. #endif
  48.  
  49. #ifdef __cplusplus
  50. extern "C" {
  51. #endif
  52.  
  53. /*
  54.  *    Time manipulation functions
  55.  */
  56.  
  57. clock_t clock(void);                        /* function */
  58. #ifndef powerc
  59.     #define clock() __tickcount()            /* macro - use TickCount() */
  60.     pascal unsigned long __tickcount(void)
  61.         = 0xA975; 
  62. #endif /* powerc */
  63.  
  64. double  difftime(time_t time1, time_t time0);                /* function */
  65. #define difftime(time1,time0) ((long double)time1 - time0)    /* macro */
  66.  
  67. time_t mktime(struct tm *timeptr);
  68. time_t time(time_t *timer);
  69.  
  70.  
  71. /*
  72.  *    Time conversion functions
  73.  */
  74.  
  75. char *asctime (const struct tm *timeptr);
  76. char *ctime(const time_t *timer);
  77. struct tm *gmtime(const time_t *timer);
  78. struct tm *localtime(const time_t *timer);
  79. size_t strftime(char *s, size_t maxsize,
  80.                  const char *format, const struct tm *timerptr);
  81.  
  82. #ifdef __cplusplus
  83. }
  84. #endif
  85.  
  86. #endif
  87.